package com.team.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.team.util.UserFilterIdCardUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Admin {
    private Integer id;
    private String account;
    private String name;
    private String password;
    private String phone;
    private Integer sid;
    private Integer status;
    private String idCard;
    private String hardUrl;
    private String education;
    private String major;
    private String prize;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date createTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date updateTime;
    private String introduction;

    private Integer age;

    private String birthday;

    public Integer getAge() {
        return (idCard == null?null:UserFilterIdCardUtil.getAgeByIdCard(idCard));
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getBirthday() {
        return idCard == null?null:UserFilterIdCardUtil.getBirthdayByIdCard(idCard);
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }
}